<template>
    <el-container class="admin-layout">
        <el-aside width="200px">
            <el-menu
                :default-active="activeMenu"
                class="admin-menu"
                router
                background-color="#304156"
                text-color="#fff"
            >
                <el-menu-item index="/admin/workflows">
                    <el-icon><Document /></el-icon>
                    <span>工作流管理</span>
                </el-menu-item>
            </el-menu>
        </el-aside>
        <el-container>
            <el-header style="height: 50px">
                <div class="admin-header">
                    <h2>{{ currentTitle }}</h2>
                </div>
            </el-header>
            <el-main>
                <router-view />
            </el-main>
        </el-container>
    </el-container>
</template>

<script lang="ts" setup>
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import { Document } from '@element-plus/icons-vue';

const route = useRoute();
const activeMenu = computed(() => route.path);
const currentTitle = computed(() => route.meta.title || '管理后台');
</script>

<style lang="scss" scoped>
.admin-layout {
    height: 100vh;

    .el-aside {
        background-color: #304156;
        color: #fff;
    }

    .admin-menu {
        border-right: none;
    }

    .el-header {
        background-color: #fff;
        border-bottom: 1px solid #e6e6e6;
        padding: 0 20px;
    }

    .admin-header {
        height: 100%;
        display: flex;
        align-items: center;

        h2 {
            margin: 0;
            font-size: 18px;
            color: #303133;
        }
    }

    .el-main {
        background-color: #f0f2f5;
        padding: 20px;
    }
}
</style> 